Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-accessor-descriptor

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-accessor-descriptor

Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.

  • 1.0.1
  • v1-backport
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15M
decreased by-48.71%
Maintainers
2
Weekly downloads
 
Created

What is is-accessor-descriptor?

The is-accessor-descriptor npm package is used to check if an object property descriptor defines an accessor descriptor. An accessor descriptor is one that includes getter and/or setter functions, as opposed to a data descriptor which contains a value and is writable.

What are is-accessor-descriptor's main functionalities?

Check if a descriptor is an accessor descriptor

This feature allows you to verify if a given property descriptor from an object is an accessor descriptor. It returns true if the descriptor has a get or set key, and false otherwise.

{"isAccessorDescriptor": require('is-accessor-descriptor');
var descriptor = Object.getOwnPropertyDescriptor({get foo() {}}, 'foo');
console.log(isAccessorDescriptor(descriptor)); //=> true
}

Check if an object is an accessor descriptor

This feature allows you to check if a plain object mimics the structure of an accessor descriptor. It is useful for validation purposes when you have an object that should represent a descriptor and you want to ensure it is an accessor descriptor.

{"isAccessorDescriptor": require('is-accessor-descriptor');
console.log(isAccessorDescriptor({get: function() {}})); //=> true
console.log(isAccessorDescriptor({set: function() {}})); //=> true
console.log(isAccessorDescriptor({value: 123})); //=> false
}

Other packages similar to is-accessor-descriptor

Keywords

FAQs

Package last updated on 26 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc